package com.smart.nacos.consumer.service;


import org.springframework.stereotype.Service;
import org.springframework.web.client.RestTemplate;

import javax.annotation.Resource;

/**
 * 负载均衡  流量均摊到每台服务器上
 * 1 轮询
 * 2.最少连接数
 * 3 轮询权重
 * 4 url_hash
 * 分类
 * 1 客服端负载均衡(Ribbon  Loadbalancer)
 * 2 服务端的负载均衡  Nginx
 * 1  处理静态资源
 * 2  反向代理
 * 3  负载均衡
 */
@Service
public class ConsumerServiceImpl implements ConsumerService {
    @Resource
    RestTemplate restTemplate;

    @Override
    public String hello() {
//        HttpURLConnection urlConnection;
//        HttpClient
//        OKHTTP

        String forObject = restTemplate.getForObject("http://nacos-example-provider:8889/hello", String.class);

        return forObject;


    }
}
